package com.xx566.blog.model;

import com.jfinal.plugin.activerecord.Model;

import java.util.List;

/**
 * 用户
 */
@SuppressWarnings("serial")
public class User extends Model<User> {

	public static final User dao = new User();

	public List<User> findAll() {
		return find("select * from user order by createtime desc");
	}

	/**
	 * 查询用户
	 * 
	 * @param username
	 * @return
	 */
	public User findIsNameUsed(String username) {
		String sql = "select count(1) hasuser from user where name=?";
		return findFirst(sql, username);
	}

}
